package codingforgreat.lchot150;

import java.util.*;

public class Lc078 {
    public List<List<Integer>> subsets(int[] nums) {
        List<List<Integer>> res = new ArrayList<>();
        List<Integer> path = new ArrayList<>();
        process(nums,0,path,res);
        return res;
    }
    public void process(int[] nums,int index,List<Integer> path, List<List<Integer>> res){
        if(index == nums.length){
            res.add(new ArrayList(path));
            return;
        }
        process(nums,index + 1,path,res);
        path.add(nums[index]);
        process(nums,index + 1,path,res);
        path.remove(path.size() - 1);
    }
}
